package com.test.hibernate.n21both;

import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.Objects;

/**
 * @author lzy
 * @version v1.0
 * Create DateTime: 2018/9/18 18:39
 */
@Data
@NoArgsConstructor
public class Order {
    private Integer orderId;
    private String orderName;
    private Customer customer;

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        Order order = (Order) o;
        return Objects.equals(orderId, order.orderId) &&
                Objects.equals(orderName, order.orderName);
    }

    @Override
    public int hashCode() {
        return Objects.hash(orderId, orderName);
    }
}
